home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13804 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: solon.com!not-for-mail
  2. From: schwarz@mips.complang.tuwien.ac.at (Konrad Schwarz)
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated
  4. Subject: Re: C coding problem
  5. Date: 10 Apr 1996 07:11:59 -0500
  6. Organization: TU Wien
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4kg8if$ijs@solutions.solon.com>
  10. References: <4j06na$808@solutions.solon.com> <4k1qh3$5hn@solutions.solon.com> <4k5vrk$a2d@solutions.solon.com> <4kbdq6$ec2@solutions.solon.com> <4kcmji$p13@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12.  
  13. In article <4kcmji$p13@solutions.solon.com>,
  14. Chris Torek <torek@elf.bsdi.com> writes:
  15.  
  16. |> /* prototype bcopy, for turning into assembly... */
  17.  
  18. |>     n = (int)src ^ (int)dst;
  19. |>     if ((int)dst & 1)
  20. |>         *dst++ = *src++, len--;
  21. |>     if ((n & 7) == 0) {
  22.  
  23. Did you separate assignment and use of n to fill a delay slot?
  24. (You use n to test maximal alignment.  If (dst, src) allows a certain
  25. alignment, I believe (dst + 1, src + 1) allow exactly the same alignment.)
  26.  
  27. |>         n = len / 8 / 8;
  28.  
  29. Why don't you use len >> 6?
  30.  
  31. |>         /* Handle any trailing `long long's. */
  32.  
  33. Does Duff's device buy you anything?
  34.  
  35. |>     /*
  36. |>      * Cannot even int-align, but still have at least 7 bytes to copy,
  37. |>      * and dst is at least short-aligned.  Copy up to two more bytes
  38. |>      * to make it int-aligned, leaving at least 5 bytes to go.  This
  39. |>      * will leave src unaligned with a 1, 2, or 3-byte offset.
  40.  
  41. I presume your not using (aligned) 2 byte moves reflects a weakness in the
  42. SPARCs you used.  Otherwise, you could fold the the 3-byte offset case into
  43. the 1-byte offset case.
  44.  
  45. Konrad Schwarz
  46.